package com.lyandwc.lw_bbs.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyandwc.lw_bbs.entity.Topic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface TopicDao extends BaseMapper<Topic> {
    Topic findTopicById(int id);

    List<Topic> listTopicsByCategoryId(
            @Param("categoryId") int categoryId,
            @Param("startIndex") int startIndex,
            @Param("limit") int limit
    );

    List<Topic> listTopicsByUserId(
            @Param("userId") int userId,
            @Param("startIndex") int startIndex,
            @Param("limit") int limit
    );

    List<Topic> listTopicsByTagId(
            @Param("tagId") int tagId,
            @Param("startIndex") int startIndex,
            @Param("limit") int limit
    );

    void updateTopicCountById(int id);
}
